# Maintainer: Nathan Osman <nathan@quickmediasolutions.com>

_realname=qmdnsengine
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.2.0
pkgrel=2
pkgdesc="Multicast DNS library for Qt applications"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64' 'clang32')
license=('MIT')
url='https://github.com/nitroshare/qmdnsengine'
depends=("${MINGW_PACKAGE_PREFIX}-qt5-base")
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-cc")
source=("https://github.com/nitroshare/qmdnsengine/archive/${pkgver}.tar.gz")
sha256sums=('b9a4e86de2afd31224ca2007713a2d9bcc0334358f831a2b83a7161b7d91c614')

build() {
  [[ -d build-${MSYSTEM} ]] && rm -rf build-${MSYSTEM}
  mkdir build-${MSYSTEM} && cd build-${MSYSTEM}

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake \
    -G"MSYS Makefiles" \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -DCMAKE_BUILD_TYPE=Release \
    ${srcdir}/${_realname}-${pkgver}

  cmake --build .
}

package() {
  cd ${srcdir}/build-${MSYSTEM}
  DESTDIR="${pkgdir}" cmake --install .
}
